﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Vav.Api.Utils
{
    class JsonLog
    {
        public string JsonLogType { get; set; } = "[JsonLogType]";
        public string Message { get; set; }
        public string Json { get; set; }
    }

    public static class JsonLogExtensions
    {
        public static string AsJsonLog<T>(this T obj, string message)
        {
            return JsonConvert.SerializeObject(new JsonLog()
            {
                Message = message,
                Json = JsonConvert.SerializeObject(obj)
            });
        }
    }
}
